import request from '@/utils/request';

// 预警综合查询列表获取
export function getWarningList (params) {
  return request({
    url: '/base/warninfo/list',
    method: 'get',
    params
  })
}

// 预警综合查询单个审核
export function updateWarning (params) {
  return request({
    url: `/base/warninfo/audit`,
    method: 'post',
    data: params
  })
}

// 预警综合查询批量审核
export function updateWarningBatch (ids) {
  return request({
    url: `/base/warninfo/close/${ids}`,
    method: 'post',
    // data: params
  })
}

/*---------------------------------预警统计分析---------------------------------*/

//预警类型数据统计
export function getWarningTypeCount (params) {
  return request({
    url: '/base/warninfo/statisTypeCount',
    method: 'get',
    params
  })
}

//地表水预警统计时间变化
export function getWarningTimeCount (params) {
  return request({
    url: '/base/warninfo/statisTypeAndTimeCount',
    method: 'get',
    params
  })
}

//预警处理情况统计
export function getWarningHandleCount (params) {
  return request({
    url: '/base/warninfo/statisStatusCount',
    method: 'get',
    params
  })
}

//预警级别数量统计
export function getWarningLevelCount (params) {
  return request({
    url: '/base/warninfo/statisWarnLevelCount',
    method: 'get',
    params
  })
}

/***---------------------------------预警配置管理--------------------------------- */
// 规则配置查询
export function getWarningRule (params) {
  return request({
    url: '/warn/warnrule/list',
    method: 'get',
    params
  })
}

// 规则配置更新
export function updateWarningRule (data) {
  return request({
    url: '/warn/warnrule/edit',
    method: 'post',
    data
  })
}

// 预警类型的接口
export function getWarningType (params) {
  return request({
    url: '/warn/warnTypeList',
    method: 'get',
    params: params || {}
  })
}

//限制预警因子更新接口

export function updateWarningFactor (data) {
  return request({
    url: '/warn/warnrulecondition/edit',
    method: 'post',
    data
  })
}

//限制预警因子删除接口
export function deleteWarningFactor (ids) {
  return request({
    url: `/warn/warnrulecondition/remove/${ids}`,
    method: 'post'
  })
}
// 限制预警因子新增接口

export function addWarningFactor (data) {
  return request({
    url: '/warn/warnrulecondition',
    method: 'post',
    data
  })
}

// 限制预警因子启用
export function enableWarningFactor (ids) {
  return request({
    url: `/warn/warnrulecondition/open/${ids}`,
    method: 'post'
  })
}

//限制预警因子关闭

export function closeWarningFactor (ids) {
  return request({
    url: `/warn/warnrulecondition/close/${ids}`,
    method: 'post'
  })
}

//限制预警因子根据ID查询详情

export function getWarningFactorById (id) {
  return request({
    url: `/warn/warnrulecondition/${id}`,
    method: 'get'
  })
}
